const path = require('path');

const Config = {
    publicPath: './',
    outputDir: 'lanfan',
    pages: {
        'index': {
            entry: 'src/main.js',
            template: 'public/index.html',
            filename: 'index.html',
            title: '懒饭'
        }
    },
    configureWebpack: config => {
        config.mode = process.env.NODE_ENV.trim() === 'production' ? 'production' : 'development';
        Object.assign(config,{
            resolve: {
                alias: {
                    '@': path.resolve(__dirname , './src')
                },
                extensions: ['.js', '.vue', '.less']
            }
        });
    },
    devServer: {
        open: 'Google Chrome',
        openPage: '/index.html',
        port: 9876,
        proxy: {
            '^/apis': {
                target: 'http://www.shuiyue.info:21000',
                pathRewrite: {'^/apis': ''}
            }
        }
    }
}

module.exports = Config;